package com.wqnmdb.im;

import com.wqnmdb.im.netty.init.NettyServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.scheduling.annotation.EnableAsync;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.net.InetSocketAddress;

@EnableAsync
@EnableCaching
@EnableSwagger2
@SpringBootApplication
public class ZyImApplication implements CommandLineRunner {

    @Autowired
    private NettyServer nettyServer;

    @Value("${netty.port}")
    private int port;

    public static void main(String[] args) {
        SpringApplication.run(ZyImApplication.class, args);
    }

    @Override
    public void run(String... args) {
        nettyServer.start(new InetSocketAddress(port));
    }
}
